package com.polukeuro.app.client.events;

import com.google.gwt.event.shared.GwtEvent;

public class ResponseErrorEvent  extends GwtEvent<RequestHandler> {

	private static Type<RequestHandler> TYPE = new Type<RequestHandler>();
	
	private final Throwable exception;

	public ResponseErrorEvent(Throwable exception) {
		super();
		this.exception= exception;
	}
	
	public ResponseErrorEvent(String message) {
		super();
		this.exception= new Exception(message);
	}

	public static Type<RequestHandler> getType() {
		return TYPE;
	}
	
	@Override
	protected void dispatch(RequestHandler handler) {
		handler.onResponseErrorEvent(this);
	}

	@Override
	public com.google.gwt.event.shared.GwtEvent.Type<RequestHandler> getAssociatedType() {
		return TYPE;
	}

	public Throwable getException() {
		return exception;
	}
	

}
